﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Text.RegularExpressions;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using BLL;
using Models;

namespace Web
{
    public partial class index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                UpdateParamInfoLogic.UpdateAllNewsAbout();
                BindData();
                LinksBindData();
                NewsBindData();
            }
            Page.Title = "首页";
            //Page.Master.Page.Title = "ChingeDesign 尚器设计 | Make a Chinge";
            //Page.Header.Title = "ssasa";
            //HtmlMeta description = new HtmlMeta();
            //description.Name = "description";
            //description.Content = "尚器设计有限公司";
            //Page.Header.Controls.Add(description);
        }

        public void BindData()
        {
            BindIndexPicInfo();
        }
        public void BindIndexPicInfo()
        {
            List<IndexPicInfo> list = IndexPicInfoLogic.GetAllIndexPicInfo();
            IndexPicRpt.DataSource = list;
            IndexPicRpt.DataBind();
        }
        public void NewsBindData()
        {
            List<NewsInfo> NewsInfoList = NewsInfoLogic.GetPageNewsInfo();
            if (NewsInfoList == null)
            {
                NewsInfoList = new List<NewsInfo>();
                NewsInfoList.Add(new NewsInfo());
            }

            NewsList.DataSource = NewsInfoList;
            NewsList.DataBind();
        }

        public void LinksBindData()
        {
            List<LinksInfo> linksinfoList = LinksInfoLogic.GetTopFourLinksInfo();
            if (linksinfoList == null)
            {
                linksinfoList = new List<LinksInfo>();
                linksinfoList.Add(new LinksInfo());
            }
            LinksList.DataSource = linksinfoList;
            LinksList.DataBind();
        }
    }
}
